﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;
using System.IO;

namespace GameSPK.DAO
{
    class ConfigXMLDAO
    {
        public static string getHomeButtonUrl()
        {
            
            string fileXML = "config/config.xml";
            if (File.Exists(fileXML))
            {
                XElement layout = XElement.Load(fileXML);
                var home = (from c in layout.Elements()
                           where c.Name == "homebutton"
                           select c).Single();
                return home.FirstAttribute.Value;
            }
            return null;
            
        }
        public static string getBackButtonUrl()
        {

            string fileXML = "config/config.xml";
            if (File.Exists(fileXML))
            {
                XElement layout = XElement.Load(fileXML);
                var home = (from c in layout.Elements()
                            where c.Name == "backbutton"
                            select c).Single();
                return home.FirstAttribute.Value;
            }
            return null;

        }
        public static string getNextButtonUrl()
        {

            string fileXML = "config/config.xml";
            if (File.Exists(fileXML))
            {
                XElement layout = XElement.Load(fileXML);
                var home = (from c in layout.Elements()
                            where c.Name == "nextbutton"
                            select c).Single();
                return home.FirstAttribute.Value;
            }
            return null;

        }
    }
}
